package com.rbw.persist.dao.impl;

import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Repository;

import com.rbw.model.TechBean;
import com.rbw.model.TechLabelBean;
import com.rbw.persist.dao.TechDao;

/**
 * 科技成果数据库操作
 * 
 *
 */
@Repository
public class TechImpl extends BaseImpl implements TechDao {
	
	public static final String NAME_SPACE = NAME_SPACE_HEADER + ".TechMapper";

	@Override
	public List<TechBean> selectByPage(Map<String, Object> params) {
		
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectList", params);
	}

	@Override
	public int selectTotal(Map<String, Object> params) {
		return sqlSessionTemplate.selectOne(NAME_SPACE + ".selectTotal", params);
	}

	@Override
	public TechBean getDetail(String tid) {
		return sqlSessionTemplate.selectOne(NAME_SPACE + ".selectById", tid);
	}
	
	@Override
	public List<TechLabelBean> selectLabelByTechId(String tid) {
		
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectLabelByTechId", tid);
	}

	@Override
	public int update(TechBean t) {
		return sqlSessionTemplate.update(NAME_SPACE + ".update", t);
		
	}

	@Override
	public List<TechBean> selectUserFavoriteByPage(Map<String, Object> params) {
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectUserFavoriteByPage", params);
	}

	@Override
	public int selectUserFavoriteTotal(Map<String, Object> params) {
		return sqlSessionTemplate.selectOne(NAME_SPACE + ".selectUserFavoriteTotal", params);
	}

	@Override
	public int selectUserTechsTotal(Map<String, Object> params) {
		return sqlSessionTemplate.selectOne(NAME_SPACE + ".selectUserTechTotal", params);
	}

	@Override
	public List<TechBean> selectUserTechsByPage(Map<String, Object> params) {
		return sqlSessionTemplate.selectList(NAME_SPACE + ".selectUserTechByPage", params);
	}

	@Override
	public int insert(TechBean tech) {
		return sqlSessionTemplate.insert(NAME_SPACE + ".insert", tech);
	}
}
